<template>
  <PageContainer>
    <UserTable v-if="currentCard === tableCard" @show-edit-table="showEditTable"></UserTable>
    <UserEditTable v-if="currentCard === editTableCard" :recode="currentRecode" @show-table="showTable"></UserEditTable>
  </PageContainer>
</template>

<script setup lang="ts">
import { PageContainer as PageContainer } from '@ant-design-vue/pro-layout';
import UserEditTable from '@/views/user/UserEditTable.vue';
import UserTable from '@/views/user/UserTable.vue';
import type { User } from '@/api/user/user';

//列表页面
const tableCard = 'tableCard';
//编辑页面
const editTableCard = 'editTableCard';

//当前页面
let currentCard = ref(tableCard);

//编辑记录
let currentRecode = ref<User>();

function showEditTable(editRecode: User) {
  currentCard.value = editTableCard;
  currentRecode.value = editRecode;
}

function showTable() {
  currentCard.value = tableCard;
}
</script>

<style lang="less" scoped></style>
